﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HCQ2_Model.Pay
{
    /// <summary>
    /// 订单状态
    /// </summary>
    /// <remarks>
    /// 20191112;老谭说去掉3(卖家已确认)
    /// </remarks>
    public class OrderStateEnum
    {
        /// <summary>
        /// 等待买家付款
        /// </summary>
        public const int OrderState1 = 1;
        /// <summary>
        /// 买家已付款
        /// </summary>
        public const int OrderState2 = 2;
        /// <summary>
        /// 交易成功
        /// </summary>
        public const int OrderState4 = 4;
        /// <summary>
        /// 交易关闭
        /// </summary>
        public const int OrderState5 = 5;
        /// <summary>
        /// 退款中
        /// </summary>
        public const int OrderState6 = 6;

        /// <summary>
        /// 卖家已发货
        /// </summary>
        /// <remarks>
        /// 2021-3-12：需求《VLions需求规格_销售管理_20210119.docx》添加
        /// </remarks>
        public const int OrderState7 = 7;


        /// <summary>
        /// 获取订单状态中文
        /// </summary>
        /// <param name="orderState"></param>
        /// <returns></returns>
        public static string GetOrderStateName(int orderState)
        {
            string name = string.Empty;
            switch (orderState)
            {
                case OrderStateEnum.OrderState1:
                    name = "等待买家付款";
                    break;
                case OrderStateEnum.OrderState2:
                    name = "买家已付款";
                    break;
                //case OrderStateEnum.OrderState3:
                //    name = "卖家已确认";
                //    break;
                case OrderStateEnum.OrderState4:
                    name = "交易成功";
                    break;
                case OrderStateEnum.OrderState5:
                    name = "交易关闭";
                    break;
                case OrderStateEnum.OrderState6:
                    name = "退款中";
                    break;
                case OrderStateEnum.OrderState7:
                    name = "卖家已发货";
                    break;
                default:
                    break;
            }

            return name;
        }
        /// <summary>
        /// 验证状态是否订单状态中值
        /// </summary>
        /// <param name="orderState">待验证的状态值</param>
        /// <returns>true合法、非法订单状态</returns>
        public static bool CheckOrderState(int orderState)
        {
            if (OrderState1 == orderState || OrderState2 == orderState || OrderState4 == orderState ||
                OrderState5 == orderState || OrderState6 == orderState || OrderState7 == orderState)
            {
                return true;
            }
            return false;
        }
    }
}
